package com 
{
	import flash.display.Sprite;
	
	/**
	 * ...
	 * @author ...
	 */
	public class BuildingLayer extends Sprite 
	{
		private var _buildingArr:Array;
		public function BuildingLayer(mapXml:XML) 
		{
			_buildingArr = new Array();
			_buildingArr = getBuildingFromXml(mapXml);
		}
		/**
		 * 从xml文件获取建筑物信息
		 * @return 建筑物数组
		 */
		private function getBuildingFromXml(xml:XML):Array
		{
			var tempArr:Array=new Array();
			for each (var item:* in xml.items.item)
			{
				var building:Building = new Building(item);
				building.x = item.@px;
				building.y = item.@py;
				this.addChild(building);
				tempArr.push(building);
			}
			return tempArr;
		}
		public function get buildingArr():Array
		{
			return _buildingArr;
		}
		
	}

}